package cn.com.panda.webapi;

import android.content.Context;

import java.util.HashMap;
import java.util.Map;

import cn.com.panda.conf.Config;
import cn.com.panda.net.http.request.HttpRequest;
import cn.com.panda.utils.DataCacheUtil;
import cn.com.panda.utils.SoftVersionUtil;

/**
 * 接口请求
 */
public class Webapi {
    private Context mContext;

    public Webapi(Context context){
        mContext = context;
    }

    public void checkVersion(HttpRequest.OnResponseLister onResponseLister){
        SoftVersionUtil softVersionUtil = new SoftVersionUtil(mContext);
        String versionName = softVersionUtil.getVersionName();
        HttpWebUtils webUtils = new HttpWebUtils();
        String url = Config.version;
        Map<String,String> header = new HashMap<>();
        header.put("accessToken", DataCacheUtil.newInstance().getString(Config.TOKEN));
        webUtils.get(url,header,onResponseLister);
    }
}
